var ZYRequestClient = require("../../../../utils/zy-request");
var requestClient;
const app = getApp();
Page({
  data:{
    paymentStatus:['待支付','交易成功','交易失败'],
    rechargeRecordList:[],
    navbarData:{
      showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
      title: '充值记录', //导航栏 中间的标题
      white:true
     },
     // 导航头的高度
     height: app.globalData.height * 2 + 20
  },
  onLoad() {
    requestClient = new ZYRequestClient();
  },
  // 加载充值记录
  loadRechargeRecordList(){
    var _this = this;
    var defaultCompany = wx.getStorageSync('defaultCompany');
    if(defaultCompany == ''){
      defaultCompany = {
        id:-1
      };
    }
    requestClient.getRechargeRecordListByCompany(defaultCompany.id,function(res){
      _this.setData({
        rechargeRecordList:res.data.data
      });
  });
  },
  onShow(){
    this.loadRechargeRecordList();
  },
  // 跳转充值记录详情
  goDetail(e){
    var recordId = e.currentTarget.dataset.id;
    var name = e.currentTarget.dataset.name;
    wx.navigateTo({
      url: '../rechargerecorddetail/index?packageName=' + name + '&recordId=' + recordId,
    })
  }
})
